package com.dream.technology.testData;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.dream.technology.db.entity.RcField;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.Arrays;
import java.util.List;

/**
 * 描述：
 *
 * @author chen_q_i@163.com
 * 2018/12/6 : 19:21.
 * @version : 1.0
 */
public class BasicFieldData {
    private static final Logger logger = LoggerFactory.getLogger(RiskAdminTest.class);


    String baseSetting = "[\n" +
            "        {\n" +
            "            \"classname\": \"BasicInfoVo\",\n" +
            "            \"classpath\": \"com.dream.technology.components.riskControl.vo\",\n" +
            "            \"dataType\": 4,\n" +
            "            \"description\": \"手机型号\",\n" +
            "            \"fieldCode\": \"mobileType\",\n" +
            "            \"fieldName\": \"手机型号\",\n" +
            "            \"fieldType\": \"基本字段\",\n" +
            "            \"functionname\": \"getMobileType\",\n" +
            "        }\n" +
            "," +
            "        {\n" +
            "            \"classname\": \"BasicInfoVo\",\n" +
            "            \"classpath\": \"com.dream.technology.components.riskControl.vo\",\n" +
            "            \"dataType\": 4,\n" +
            "            \"description\": \"渠道\",\n" +
            "            \"fieldCode\": \"channel\",\n" +
            "            \"fieldName\": \"渠道\",\n" +
            "            \"fieldType\": \"基本字段\",\n" +
            "            \"functionname\": \"getChannel\",\n" +
            "        }\n" +
            "," +
            "        {\n" +
            "            \"classname\": \"BasicInfoVo\",\n" +
            "            \"classpath\": \"com.dream.technology.components.riskControl.vo\",\n" +
            "            \"dataType\": 4,\n" +
            "            \"description\": \"子渠道\",\n" +
            "            \"fieldCode\": \"childChannel\",\n" +
            "            \"fieldName\": \"渠道\",\n" +
            "            \"fieldType\": \"基本字段\",\n" +
            "            \"functionname\": \"getChildChannel\",\n" +
            "        }\n" + "," +
            "        {\n" +
            "            \"classname\": \"BasicInfoVo\",\n" +
            "            \"classpath\": \"com.dream.technology.components.riskControl.vo\",\n" +
            "            \"dataType\": 1,\n" +
            "            \"description\": \"西瓜分\",\n" +
            "            \"fieldCode\": \"xiguaSore\",\n" +
            "            \"fieldName\": \"西瓜分\",\n" +
            "            \"fieldType\": \"基本字段\",\n" +
            "            \"functionname\": \"getXiguaScore\",\n" +
            "        }\n" + "," +
            "        {\n" +
            "            \"classname\": \"BasicInfoVo\",\n" +
            "            \"classpath\": \"com.dream.technology.components.riskControl.vo\",\n" +
            "            \"dataType\": 1,\n" +
            "            \"description\": \"芝麻分\",\n" +
            "            \"fieldCode\": \"zhimaScore\",\n" +
            "            \"fieldName\": \"芝麻分\",\n" +
            "            \"fieldType\": \"基本字段\",\n" +
            "            \"functionname\": \"getZhimaScore\",\n" +
            "        }\n" +
            "    ]";

    static String borrowingField = "[\n" +
            "        {\n" +
            "            \"classname\": \"BorrowingFormVo\",\n" +
            "            \"classpath\": \"com.dream.technology.components.riskControl.vo\",\n" +
            "            \"dataType\": 5,\n" +
            "            \"description\": \"借款时间\",\n" +
            "            \"fieldCode\": \"borrowingTime\",\n" +
            "            \"fieldName\": \"借款时间\",\n" +
            "            \"fieldType\": \"基本字段\",\n" +
            "            \"functionname\": \"getBorrowingTime\",\n" +
            "        }\n" +
            "," +
            "        {\n" +
            "            \"classname\": \"BorrowingFormVo\",\n" +
            "            \"classpath\": \"com.dream.technology.components.riskControl.vo\",\n" +
            "            \"dataType\": 5,\n" +
            "            \"description\": \"预计还款时间\",\n" +
            "            \"fieldCode\": \"predictRepaymentTime\",\n" +
            "            \"fieldName\": \"预计还款时间\",\n" +
            "            \"fieldType\": \"基本字段\",\n" +
            "            \"functionname\": \"getPredictRepaymentTime\",\n" +
            "        }\n" +
            "," +
            "        {\n" +
            "            \"classname\": \"BorrowingFormVo\",\n" +
            "            \"classpath\": \"com.dream.technology.components.riskControl.vo\",\n" +
            "            \"dataType\": 5,\n" +
            "            \"description\": \"实际还款时间\",\n" +
            "            \"fieldCode\": \"repaymentTime\",\n" +
            "            \"fieldName\": \"实际还款时间\",\n" +
            "            \"fieldType\": \"基本字段\",\n" +
            "            \"functionname\": \"getRepaymentTime\",\n" +
            "        }\n" +
            "," +
            "        {\n" +
            "            \"classname\": \"BorrowingFormVo\",\n" +
            "            \"classpath\": \"com.dream.technology.components.riskControl.vo\",\n" +
            "            \"dataType\": 5,\n" +
            "            \"description\": \"放款时间\",\n" +
            "            \"fieldCode\": \"loanTime\",\n" +
            "            \"fieldName\": \"放款时间\",\n" +
            "            \"fieldType\": \"基本字段\",\n" +
            "            \"functionname\": \"getLoanTime\",\n" +
            "        }\n" +
            "," +
            "        {\n" +
            "            \"classname\": \"BorrowingFormVo\",\n" +
            "            \"classpath\": \"com.dream.technology.components.riskControl.vo\",\n" +
            "            \"dataType\": 5,\n" +
            "            \"description\": \"申请时间\",\n" +
            "            \"fieldCode\": \"applyTime\",\n" +
            "            \"fieldName\": \"申请时间\",\n" +
            "            \"fieldType\": \"基本字段\",\n" +
            "            \"functionname\": \"getApplyTime\",\n" +
            "        }\n" +
            "," +
            "        {\n" +
            "            \"classname\": \"BorrowingFormVo\",\n" +
            "            \"classpath\": \"com.dream.technology.components.riskControl.vo\",\n" +
            "            \"dataType\": 1,\n" +
            "            \"description\": \"借款期限\",\n" +
            "            \"fieldCode\": \"interestperiods\",\n" +
            "            \"fieldName\": \"借款期限\",\n" +
            "            \"fieldType\": \"基本字段\",\n" +
            "            \"functionname\": \"getInterestperiods\",\n" +
            "        }\n" +
            "," +
            "        {\n" +
            "            \"classname\": \"BorrowingFormVo\",\n" +
            "            \"classpath\": \"com.dream.technology.components.riskControl.vo\",\n" +
            "            \"dataType\": 1,\n" +
            "            \"description\": \"借款金额\n\",\n" +
            "            \"fieldCode\": \"borrowingAmount\",\n" +
            "            \"fieldName\": \"借款金额\n\",\n" +
            "            \"fieldType\": \"基本字段\",\n" +
            "            \"functionname\": \"getBorrowingAmount\",\n" +
            "        }\n" +
            "," +
            "        {\n" +
            "            \"classname\": \"BorrowingFormVo\",\n" +
            "            \"classpath\": \"com.dream.technology.components.riskControl.vo\",\n" +
            "            \"dataType\": 1,\n" +
            "            \"description\": \"放款金额\n\",\n" +
            "            \"fieldCode\": \"loanAmount\",\n" +
            "            \"fieldName\": \"放款金额\n\",\n" +
            "            \"fieldType\": \"基本字段\",\n" +
            "            \"functionname\": \"getLoanAmount\",\n" +
            "        }\n" +
            "," +
            "        {\n" +
            "            \"classname\": \"BorrowingFormVo\",\n" +
            "            \"classpath\": \"com.dream.technology.components.riskControl.vo\",\n" +
            "            \"dataType\": 1,\n" +
            "            \"description\": \"实际还款金额\n\",\n" +
            "            \"fieldCode\": \"repaymentAmount\",\n" +
            "            \"fieldName\": \"实际还款金额\n\",\n" +
            "            \"fieldType\": \"基本字段\",\n" +
            "            \"functionname\": \"getRepaymentAmount\",\n" +
            "        }\n" +
            "," +
            "        {\n" +
            "            \"classname\": \"BorrowingFormVo\",\n" +
            "            \"classpath\": \"com.dream.technology.components.riskControl.vo\",\n" +
            "            \"dataType\": 1,\n" +
            "            \"description\": \"逾期天数\n\",\n" +
            "            \"fieldCode\": \"overdueDays\",\n" +
            "            \"fieldName\": \"逾期天数\n\",\n" +
            "            \"fieldType\": \"基本字段\",\n" +
            "            \"functionname\": \"getOverdueDays\",\n" +
            "        }\n" +
            "    ]";


    static String borrowSelect = "   [\n" +
            "        {\n" +
            "            \"fieldId\": 16,\n" +
            "            \"name\": \"interestperiods\",\n" +
            "            \"description\": \"7天借款\",\n" +
            "            \"value\": \"7\"\n" +
            "        },\n" +
            "        {\n" +
            "            \"fieldId\": 16,\n" +
            "            \"name\": \"interestperiods\",\n" +
            "            \"description\": \"14天借款\",\n" +
            "            \"value\": \"14\"\n" +
            "        },\n" +


            "    ]";

    public static void main(String[] args) {
        String str = "ale|cd&(jke|iuy)";
        String s = str.replaceAll("&|\\||\\(|\\)", ",");
        System.out.println("s================>{}" + s);
        String[] split = s.replaceAll(",+", ",").split(",");
        System.out.println(split.length + "===" + Arrays.toString(split));
        Arrays.stream(split).forEach(System.out::println);
        Arrays.stream(split).forEach(x -> System.out.println(x.length()));
    }

    @Test
    public void paseArr() {

        List<RcField> rcFields = JSONArray.parseArray(borrowingField, RcField.class);
        rcFields.forEach(x -> logger.info(">>>>>>>>>>>>>>>{}", JSON.toJSONString(x)));
    }
}
